package br.com.webcrm.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import br.com.webcrm.dao.QuestionarioDAO;
import br.com.webcrm.model.Questionario;

@Repository(value = "questionarioDAO")
public class QuestionarioDAOImpl extends BaseDAOImpl<Questionario, Integer> implements QuestionarioDAO {

	@Autowired
	public QuestionarioDAOImpl(
			@Qualifier("sessionFactory") SessionFactory factory) {
		super.setSessionFactory(factory);
	}

	@Override
	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
	public List<Questionario> consultarTodos() throws Exception {
		return consultarPorNamedQuery("Questionario.findAll");
	}
}
